﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WSManager.DataAccess;
using WSManager.Model;

namespace WSManager.Wpf.Dialogs
{
    /// <summary>
    /// Interaction logic for CreateWeb.xaml
    /// </summary>
    public partial class CreateWeb : Window
    {
        protected Action<Web> callback;
        Web web = new Web();
        WebRepository[] webRepositories;

        public CreateWeb(Action<Web> callback, params WebRepository[] webRepos)
        {
            this.callback = callback;
            this.webRepositories = webRepos;
            InitializeComponent();
        }

        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            RefreshWeb();
            callback(web);
            this.Close();
        }

        void RefreshWeb()
        {
            web.Name = nameTb.Text;
            web.Repair();
        }
    }
}
